package com.jackiechancinema.ssm.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageInfo;
import com.jackiechancinema.ssm.config.SystemContant;
import com.jackiechancinema.ssm.dao.MovTypeDao;
import com.jackiechancinema.ssm.entity.MovType;
import com.jackiechancinema.ssm.entity.Movices;
import com.jackiechancinema.ssm.service.Inte.MovTypeServlet;
import com.jackiechancinema.ssm.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MovTypeController {
    @Autowired
    private MovTypeServlet movTypeServlet;

    @RequestMapping("/tt1")
    @ResponseBody
    public String t1(int id) throws JsonProcessingException {
        MovType byId = movTypeServlet.findById(id);
        //创建一个jackson的对象映射器，用来解析数据
        ObjectMapper objectMapper = new ObjectMapper();
        //将我们的对象解析成为json格式
        String s = objectMapper.writeValueAsString(byId);
        System.out.println(s);
        return s;
    }


}
